import by.bsuir.sn.dto.User;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import java.util.ArrayList;
import java.util.List;

public class Main
{
	public static void main(String args[])
	{
		SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
		List users = new ArrayList<User>();
		Session session = null;
		try
		{
			session = sessionFactory.openSession();
			users = session.createCriteria(User.class).list();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			if(session != null && session.isOpen())
			{
				session.close();
			}
		}
		System.out.println(users);
	}
}
